<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    @include('public.h5_head')
    <title>订单查询</title>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/rem.js"></script>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/common.css"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/inquire.css"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/mobiscroll.core-2.5.2.css"  />
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/mobiscroll.android-ics-2.5.2.css"  />
</head>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/app.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/common.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/mobiscroll.core-2.5.2.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/mobiscroll.datetime-2.5.1.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/mobiscroll.android-ics-2.5.2.js"></script>
<body>
<div id="inquire_box">
    <div class="wrap">
        <div class="inquire">
            <ul class="inquire_ul">
                <li class="inquire_li">
                    <span class="inquire_sp">品牌名称</span>
                    <select name="" class="inquire_sel">
                        <option value="">请选择您的品牌名称（选填）</option>
                        @foreach($brandName as $k => $v)
                        <option value="{{ $k }}">{{ $v }}</option>
                            @endforeach
                    </select>
                </li>
                <li class="inquire_li">
                    <span class="inquire_sp">商品款号</span>
                    <div class="inquire_right">
                        <input class="inquire_inp inquire_size" type="text" placeholder="请填写商品款号（选填）" />
                    </div>
                </li>
                <li class="inquire_li">
                    <span class="inquire_sp">商品颜色</span>
                    <input class="inquire_inp inquire_color" maxlength="4" type="text" placeholder="请填写商品颜色（选填）" />
                </li>
                <li class="inquire_li" id="33">
                    <span class="inquire_sp">购买日期</span>
                    <input class="date_start" id="data" type="text" placeholder="购买日期（选填）" />
                    <span class="inquire_interval">-</span>
                    <input class="date_end" id="data" type="text" placeholder="购买日期（选填）" />
                </li>
                <li class="inquire_li">
                    <span class="inquire_sp">商品价格</span>
                    <input class="price_start" maxlength="10" type="text" placeholder="价格范围（选填）" />
                    <span class="inquire_interval">-</span>
                    <input class="price_end" maxlength="10" type="text" placeholder="价格范围（选填）" />
                </li>
                <li class="inquire_li">
                    <span class="inquire_sp">订单编号</span>
                    <input class="inquire_inp inquire_code" maxlength="30" type="text" placeholder="请填写订单编号（选填）" />
                </li>
                <li class="inquire_li">
                    注:以上条件必填一种
                </li>
            </ul>
            <div class="inquire_btn"><a href="javascript:;">查询</a></div>
        </div>
    </div>
    <div class="inquire_hide" style="display:none;">
        <p class="inquire_pass"></p>
        <p class="inquire_ok">确定</p>
    </div>
    <div class="inquire_mask" style="display:none;"></div>
</div>
<script>
    /*时间选择*/
    $(function() {
        var currYear = (new Date()).getFullYear();
        var opt = {};
        opt.date = {preset:'date',stepMinute:1};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'bottom', //显示方式
            mode: 'scroller', //日期选择模式
            lang: 'zh',
            startYear: currYear-2, //开始年份currYear - 10,
            endYear: currYear,//结束年份currYear + 10
            setText: '确定',
            cancelText: '取消',
            /*清楚默认样式，更改中文模式*/
            dateFormat: 'yyyy/mm/dd',
            dateOrder: 'yymmdd',
            dayNames: ['周日', '周一;', '周二;', '周三', '周四', '周五', '周六'],
            dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
            dayText: '日',
            hourText: '时',
            minuteText: '分',
            monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
            monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
            monthText: '月',
            secText: '秒',
            timeFormat: 'HH:ii',
            timeWheels: 'HHii',
            yearText: '年'
        };
        var optDateTime = $.extend(opt['date'], opt['default']);//年月日型
        $(".date_start").mobiscroll(optDateTime).date(optDateTime);
        $(".date_end").mobiscroll(optDateTime).date(optDateTime);
    });
    /*点击查询按钮*/
    function date(){
        var s4=$('.date_start').val();/*获取初始购买日期*/
        var s5=$('.date_end').val();/*获取结束购买日期*/
        var date1 = new Date(s4).getTime();
        var date2 = new Date(s5).getTime();
        if(date1>date2){
            $(".inquire_pass").html('开始时间大于结束时间');
            $(".inquire_hide").show();
            $(".inquire_mask").show();
            return false;
        } else{
            return true;
        }
    }
    function price(){
        var s6=$('.price_start').val();/*获取初始商品价格*/
        var s7=$('.price_end').val(); /*获取结束商品价格*/
        if(parseInt(s6)>=parseInt(s7)){
            $(".inquire_pass").html('最小价格大于最大价格');
            $(".inquire_hide").show();
            $(".inquire_mask").show();
            return false;
        } else{
            return true;
        }
    }
    //点击确定隐藏
    $(".inquire_ok").click(function(){
        $(".inquire_hide").hide();
        $(".inquire_mask").hide();
    })
    $('.inquire_btn').click(function(){
        var s1= $('.inquire_sel').val();/*获取品牌名称*/
        var s2=$('.inquire_size').val();/*获取商品款号*/
        var s3=$('.inquire_color').val(); /*获取商品颜色*/
        var s4=$('.date_start').val();/*获取初始购买日期*/
        var s5=$('.date_end').val();/*获取结束购买日期*/
        var s6=$('.price_start').val();/*获取初始商品价格*/
        var s7=$('.price_end').val(); /*获取结束商品价格*/
        var s8=$('.inquire_code').val();/*获取订单编号*/

        if(s1=="" && s2=="" && s3=="" && s4=="" && s5=="" && s6=="" && s7=="" && s8==""){
            $(".inquire_pass").html('以上条件必填一种');
            $(".inquire_hide").show();
            $(".inquire_mask").show();
        }else{
            var s9='/user/findResult';
            if(date()&& price()){
                var s4=$('.date_start').val();/*获取初始购买日期*/
                var s5=$('.date_end').val();/*获取结束购买日期*/
                var s6=$('.price_start').val();/*获取初始商品价格*/
                var s7=$('.price_end').val(); /*获取结束商品价格*/
                if(s5==""){
                    window.location.href=s9+"?brand="+s1+"&girard="+s2+"&color="+s3+"&start_time="+s4+"&end_time="+s5+"&start_price="+s6+"&end_price="+s7+"&order_num="+s8;
                }else{
                    window.location.href=s9+"?brand="+s1+"&girard="+s2+"&color="+s3+"&start_time="+s4+"&end_time="+s5+" 23:59:59"+"&start_price="+s6+"&end_price="+s7+"&order_num="+s8;
                }

            }
        }
    })
    /*点击日期清除按钮，清空input框*/
    $(document).on('click','.dwb-n',function(){
        $(".date_start").val("");
        $(".date_end").val("");
    });
</script>
</body>
</html>
